Skip to content

metaslab: expose zfs_metaslab_condense_pct and zfs_metaslab_sm_blksz_* on Linux#18594

Open
chrislongros wants to merge 1 commit into
openzfs:masterfrom
chrislongros:feature/expose-zfs-condense-pct-on-linux
Open

metaslab: expose zfs_metaslab_condense_pct and zfs_metaslab_sm_blksz_* on Linux#18594
chrislongros wants to merge 1 commit into
openzfs:masterfrom
chrislongros:feature/expose-zfs-condense-pct-on-linux

Conversation

@chrislongros
Copy link
Copy Markdown
Contributor

@chrislongros chrislongros commented May 27, 2026

Motivation and Context

zfs_condense_pct controls how aggressively per-metaslab on-disk space maps are rewritten in compact form.
zfs_metaslab_sm_blksz_with_log controls Block size for space map in pools with log space map enabled.
They are already tunables on FreeBSD but had no Linux equivalents.

Description

  • Register zfs_condense_pct and zfs_metaslab_sm_blksz_* with ZFS_MODULE_PARAM in module/zfs/metaslab.c, alongside the existing metaslab tunables.
  • Add a matching entry in man/man4/zfs.4.

How Has This Been Tested?

Tested on an Arch Linux VM with the patched module.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Quality assurance (non-breaking change which makes the code more robust against bugs)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
  • Documentation (a change to man pages or other documentation)

Checklist:

@behlendorf behlendorf added the Status: Accepted Ready to integrate (reviewed, tested) label May 27, 2026
Copy link
Copy Markdown
Member

@amotin amotin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. But I see there also zfs_metaslab_sm_blksz_*, which are also not OS-specific. And may be while at it zfs_condense_pct could be renamed to not collide with zpool condense in #16747.

@chrislongros
Copy link
Copy Markdown
Contributor Author

chrislongros commented May 28, 2026

Good catch. But I see there also zfs_metaslab_sm_blksz_*, which are also not OS-specific. And may be while at it zfs_condense_pct could be renamed to not collide with zpool condense in #16747.

What about zfs_spacemap_condense_pct as a new alternative name?

@amotin
Copy link
Copy Markdown
Member

amotin commented May 28, 2026

What about zfs_spacemap_condense_pct as a new alternative name?

I'd think all 3 should go same way for uniformity. We don't have "spacemap" node, but we do have "metaslab" node, where the other two are living now.

@behlendorf behlendorf added Status: Code Review Needed Ready for review and testing Status: Revision Needed Changes are required for the PR to be accepted and removed Status: Accepted Ready to integrate (reviewed, tested) Status: Code Review Needed Ready for review and testing labels May 28, 2026
@chrislongros chrislongros force-pushed the feature/expose-zfs-condense-pct-on-linux branch from 5ecf8ec to 459cb7f Compare May 30, 2026 17:16
@github-actions github-actions Bot removed the Status: Revision Needed Changes are required for the PR to be accepted label May 30, 2026
@chrislongros chrislongros changed the title metaslab: expose zfs_condense_pct on Linux metaslab: expose zfs_metaslab_condense_pct and zfs_metaslab_sm_blksz_* on Linux May 30, 2026
Comment thread module/zfs/metaslab.c Outdated
"Block size for space map in pools with log space map disabled. "
"Power of 2 greater than 4096.");

ZFS_MODULE_PARAM(zfs_metaslab, zfs_metaslab_, sm_blksz_with_log, INT, ZMOD_RD,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see a point why those two are read-only. Lets make them ZMOD_RW.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah right !!

@chrislongros chrislongros force-pushed the feature/expose-zfs-condense-pct-on-linux branch from 459cb7f to e831c45 Compare June 1, 2026 18:01
Copy link
Copy Markdown
Contributor

@behlendorf behlendorf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just needs a rebase.

@behlendorf behlendorf added the Status: Code Review Needed Ready for review and testing label Jun 1, 2026
@chrislongros chrislongros force-pushed the feature/expose-zfs-condense-pct-on-linux branch from e831c45 to 8fef94e Compare June 1, 2026 18:05
Expose zfs_metaslab_condense_pct and zfs_metaslab_sm_blksz_* as
module parameters on Linux, matching their existing FreeBSD sysctls.

Signed-off-by: Christos Longros <chris.longros@gmail.com>
@chrislongros chrislongros force-pushed the feature/expose-zfs-condense-pct-on-linux branch from 8fef94e to 8f02983 Compare June 1, 2026 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Status: Code Review Needed Ready for review and testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants